package com.example.sal.service.impl;

import com.example.sal.pojo.Logistics;
import com.example.sal.pojo.Tech;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogisticsServiceImpl {
    /**
     * 后勤类员工的最新薪金
     */
    public Double calLogisticeSal(Logistics logistics, List<Tech> teches) {
        // teaches 提取出来，获取它的奖金属性，加起来（存进去），除以人数
//        logistics.setAveaward(ave);

        double sum = 0;

        for (Tech tech : teches) {
            sum+=tech.getAward();
        }
        Double avg=sum/teches.size();

        logistics.setTotalSal(logistics.getBaseSal() + avg);
        return logistics.getBaseSal() + avg;
    }
}
